﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasertTemplates.Master" AutoEventWireup="true"
    CodeBehind="MediaRoomVideo.aspx.cs" Inherits="WebApplication.MediaRoomVideo" %>

<%@ Register TagPrefix="uc1" TagName="usermeg" Src="~/UserControl/UserMessageControl.ascx" %>
<%@ Register TagPrefix="uc1" TagName="maintab" Src="~/UserControl/MainTabControl.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="Media/Css/jquery.lightbox-0.5.css" rel="Stylesheet" />
    <link href="media/js/jquery.uploadify-v2.1.4/uploadify.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="Media/Js/jquery.lightbox-0.5.js"></script>
    <script type="text/javascript" src="media/js/jquery.uploadify-v2.1.4/swfobject.js"></script>
    <script type="text/javascript" src="media/js/jquery.uploadify-v2.1.4/jquery.uploadify.v2.1.4.min.js"></script>
    <script type="text/javascript" src="xhEditor/xheditor-zh-cn.min.js"></script>
    <script type="text/javascript" src="media/js/jquery-ui-1.8.10.custom.min.js"></script>
    <script type="text/javascript">
        var custuid = '<%=CustUID %>';
        $(document).ready(function () {

            ///图片上传初始化 开始
            $("#uploadify").uploadify({
                'uploader': 'media/js/jquery.uploadify-v2.1.4/uploadify.swf',
                'script': 'ServerAshxFile/JqueryUploadHandler.ashx',
                'scriptData': { 'mediaType': 'video', 'add_update': 'add', 'custuid': custuid, 'type': 'BranchVideo' },
                'method': 'GET',
                'cancelImg': 'media/js/jquery.uploadify-v2.1.4/cancel.png',
                'folder': 'media/upload/logo',
                'queueID': 'fileQueue',
                'auto': false,
                'multi': false,
                'displayData': 'speed',
                'fileExt': '*.flv',
                'fileDesc': 'Flv Files',
                'sizeLimit': 202512000,
                'onInit': function () { },
                'onSelect': function (e, queueId, fileObj) {
                    $('#id_message').html("您选的文件:" + fileObj.name + "\r\n" + "文件大小:" + fileObj.size + "bytes \r\n");
                },
                'onAllComplete': function (event, data) {

                    $.get("ServerAshxFile/MediaRoomVideo.ashx", { 'type': '1' }, function (data) {
                        if (data != '') {
                            $("#tb_video").prepend(data);
                            $('#id_message').html("上传成功！");

                            $("#ContentPlaceHolder2_txtVideoName").val('');
                            //ToggleDocument('wrapToggle');
                        }
                    });
                }

            });
            ///图片上传初始化 结束 开始

            //按钮点击事件 开始
            $("#btnSave").click(function () {
                $('#id_message').html('');
                var upload = $("#uploadify");
                var extendFileName = $("#ContentPlaceHolder2_txtVideoName").val();
                if (extendFileName.trim() == '') {
                    $('#id_message').html('请填写个别名.');
                    return;
                }
                if (upload != null) {
                    upload.uploadifySettings('scriptData', { 'aliasName': $("#ContentPlaceHolder2_txtVideoName").val() });
                    upload.uploadifyUpload();
                }
            });
            //按钮点击事件 结束

        });

        function DeleteMediaRoom(mediaroomUID) {
            ToggleDocument('ConfirmBox');
            $("#id_confirm_message").html("确定删除吗？");
            $("#id_confire_event").attr("href", "javascript:DeleteMediaRoom_real(" + mediaroomUID + ")");
        }

        function DeleteMediaRoom_real(mediaroomUID) {
            var CustomerUID = '<%=CustUID %>';
            $.ajax({
                url: "ServerAshxFile/MediaRoomVideo.ashx?type=2&mediaroomUID=" + mediaroomUID + "&Cuid=" + CustomerUID,
                type: "POST",
                success: function (data) {
                    if (data != '0') {
                        $('#tr_mediaroom_' + mediaroomUID).hide("explode", { pieces: 18 }, 800);
                        $("#tr_mediaroom_" + mediaroomUID).remove();
                        ToggleDocument('ConfirmBox');
                    }
                }
            });
        }

        function ShowUpload() {
            //var obj = $("#wrapToggle");
            //if (obj.css("display") != 'block') {
                //obj.css("display", 'block');
            //}
            ToggleDocument('wrapToggle');
            $("#id_message").html("");
        }

    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <input type="hidden" value="t23" id="pageName" />
    <div class="content-title">
        <h1>
            Customer - Media Room</h1>
    </div>
    <div class="con-nav">
        <a href="#" class="btn"><span class="ui-icon ui-icon-newwin"></span>Add New Customer</a>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <uc1:usermeg ID="usermeg" runat="server"></uc1:usermeg>
    <div class="partWrap">
        <uc1:maintab ID="maintab" runat="server" />
        <div class="clear20">
        </div>
        <p class="upinput">
            <asp:HyperLink ID="hyMediaRoomImg" runat="server">Image</asp:HyperLink>
            | <span>Video</span></p>
        <div class="clear10">
        </div>
        <ul class="uibtn">
            <li onclick="javascript:ShowUpload()"><span>Add Video</span></li>
        </ul>
        <div class="clear10">
        </div>
        <div id="wrapToggle" class="wrapToggle">
            <table border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td>
                        Name:<asp:TextBox ID="txtVideoName" runat="server"></asp:TextBox>
                    </td>
                    <td>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div id="fileQueue">
                        </div>
                        <input type="file" name="uploadify" id="uploadify" />
                        <br />
                        <span id="id_message" style="background-color: #ffc; color: Red;"></span>
                    </td>
                    <td>
                    </td>
                </tr>
                <tr>
                    <td>
                       <span class="red italic">Video Specifications: Format flv; File Size: 4M</span>
                    </td>
                </tr>
            </table>
            <div class="clear10">
            </div>
            <table border="0" cellspacing="0" cellpadding="0" class="btnwrap">
                <tr>
                    <td class="btnwrapl">
                        <ul class="uibtn">
                            <li><a id="btnSave" href="">Save</a></li>
                        </ul>
                    </td>
                    <td class="btnwrapr">
                        <ul class="uibtn">
                            <li onclick="javascript:ShowUpload()"><span>Quit</span></li>
                        </ul>
                    </td>
                    <td>
                    </td>
                </tr>
            </table>
        </div>

        <%--弹出提示框 confirm 开始--%>
                        <div class="msgBoxPS">
                            <div class="SendEmailBox" id="ConfirmBox">
                                <table width="100%" border="0">
                                    <tr>
                                        <td>
                                            <h4>
                                                <img src="Media/Css/images/del-select.png" class="closeBtn" onclick="ToggleDocument('ConfirmBox');"
                                                    alt="" /><strong>确定信息.</strong></h4>
                                            <br />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <table id="Table1" width="100%" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                    <td>
                                                        <span id="id_confirm_message" style="color:red; font-weight:bold;"></span>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                                <table border="0" cellspacing="0" cellpadding="0" class="btnwrap">
                                    <tr>
                                        <td class="btnwrapl">
                                            <ul class="uibtn">
                                                <li><a id="id_confire_event" href='javascript:ToggleDocument("ConfirmBox")'>Yes</a></li>
                                            </ul>
                                        </td>
                                        <td class="btnwrapr">
                                             <ul class="uibtn">
                                                <li><a href='javascript:ToggleDocument("ConfirmBox")'>No</a></li>
                                            </ul>
                                        </td>
                                        <td>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                        <%--弹出提示框 confirm 结束--%>

        <h4 class="title20">
            Videos</h4>
        <table width="250" border="0" cellspacing="0" cellpadding="0" id="tb_video">
            <asp:Repeater ID="rp_BranchVideo" runat="server">
                <ItemTemplate>
                    <tr id='<%# "tr_mediaroom_"+ Eval("MediaRoomUID")%>'>
                        <td>                          
                             <object type="application/x-shockwave-flash" data="/Media/vcastr/vcastr3.swf" width="100"
                                height="75" id="vcastr3">
                                <param name="allowFullScreen" value="true" />
                                <param name="FlashVars" value='xml=<vcastr><channel><item><source><%#Eval("FilePath") %><%#Eval("FileName") %><%#Eval("FileExt") %></source></item></channel><config><defautVolume>0</defautVolume><controlPanelMode>float</controlPanelMode><isAutoPlay>false</isAutoPlay><isLoadBegin>true</isLoadBegin><isRepeat>false</isRepeat></config></vcastr>' />
                            </object>
                        </td>
                        <td>
                             <%#Eval("AliasName")%>
                        </td>
                        <td><a href='javascript:DeleteMediaRoom(<%#Eval("MediaRoomUID") %>)'>
                            <img src="Media/Css/images/del-form.png" alt="delete" /></a>
                        </td>
                    </tr>
                </ItemTemplate>
            </asp:Repeater>
            <%--<tr>
                <td>
                    Video name
                </td>
                <td width="30">
                    <img src="Media/Css/images/play_ico.png" alt="" />
                </td>
                <td width="30">
                    <img src="Media/Css/images/del-form.png" alt="" />
                </td>
            </tr>
            --%>
        </table>
    </div>


</asp:Content>
